package cn.yuanqiao.archive.appManager.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.annotation.IdAnnotation;
import cn.yuanqiao.common.exception.ServiceException;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotNull;

/**
 * codelist对象 YQDA_CODELIST_MODEL
 * 
 * @author yuanqiao
 * @date 2023-06-15
 */
public class TenantCodeList extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    public static final String BIGTABLENAME = "_CODELIST";

    public TenantCodeList() {
        String tenantCode = SecurityUtils.getTenantCode();
        if(StringUtils.isEmpty(tenantCode)){
          //  throw new ServiceException("tenantCode is null");
        }else {
            this.tableName = tenantCode.toUpperCase()+BIGTABLENAME;
        }
    }

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /** 主键id */
    @IdAnnotation
    @JsonFormat(shape = JsonFormat.Shape.STRING)//转化成string传到前端
    private Long Id;

    /** 档号规则id */
    @NotNull(message = "请选择档号规则")
    @Excel(name = "档号规则")
    private Long archivalcodeRuleId;

    /** 固定值/著录项值 */
    @NotNull(message = "请选择固定值/著录项值")
    @Excel(name = "固定值/著录项值")
    private String type;

    /** 节点值 */
    @NotNull(message = "请填写节点值")
    @Excel(name = "节点值")
    private String nodeValue;

    /** 补零项长度 */
    @Excel(name = "补零项长度")
    private Integer len;

    /** 排序 */
    @NotNull(message = "请填写排序值")
    @Excel(name = "排序")
    private Integer orderNo;

    /** 创建人id */
    @Excel(name = "创建人id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)//转化成string传到前端
    private Long creatorId;

    /** 创建人 */
    @Excel(name = "创建人")
    private String creator;

    /** 类型 */
    @NotNull(message = "请填写类型")
    @Excel(name = "类型", readConverterExp = "v=案卷f=件e=电子文件")
    private String VFETYPE;

    public void setId(Long Id) 
    {
        this.Id = Id;
    }

    public Long getId() 
    {
        return Id;
    }
    public void setArchivalcodeRuleId(Long archivalcodeRuleId) 
    {
        this.archivalcodeRuleId = archivalcodeRuleId;
    }

    public Long getArchivalcodeRuleId() 
    {
        return archivalcodeRuleId;
    }
    public void setType(String type) 
    {
        this.type = type;
    }

    public String getType() 
    {
        return type;
    }
    public void setNodeValue(String nodeValue) 
    {
        this.nodeValue = nodeValue;
    }

    public String getNodeValue() 
    {
        return nodeValue;
    }
    public void setLen(Integer len) 
    {
        this.len = len;
    }

    public Integer getLen() 
    {
        return len;
    }
    public void setOrderNo(Integer orderNo) 
    {
        this.orderNo = orderNo;
    }

    public Integer getOrderNo() 
    {
        return orderNo;
    }
    public void setCreatorId(Long creatorId) 
    {
        this.creatorId = creatorId;
    }

    public Long getCreatorId() 
    {
        return creatorId;
    }
    public void setCreator(String creator) 
    {
        this.creator = creator;
    }

    public String getCreator() 
    {
        return creator;
    }
    public void setVFETYPE(String VFETYPE) 
    {
        this.VFETYPE = VFETYPE;
    }

    public String getVFETYPE() 
    {
        return VFETYPE;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("Id", getId())
            .append("archivalcodeRuleId", getArchivalcodeRuleId())
            .append("type", getType())
            .append("nodeValue", getNodeValue())
            .append("len", getLen())
            .append("orderNo", getOrderNo())
            .append("creatorId", getCreatorId())
            .append("creator", getCreator())
            .append("createTime", getCreateTime())
            .append("VFETYPE", getVFETYPE())
            .toString();
    }
}
